package net.happy2v.file.server.test.file.test;

import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.nio.channels.FileChannel;

import org.jboss.netty.buffer.ChannelBuffer;
import org.jboss.netty.buffer.ChannelBuffers;

public class test {

	public static void main(String[] args) {
		ChannelBuffer buf = ChannelBuffers.copiedBuffer("A".getBytes());
		System.out.println("buf.readableBytes() : " + buf.readableBytes());
		FileChannel fc;
		try {
			fc = new FileOutputStream("FileChannel_" + "overdat").getChannel();
			try {
				fc.write(buf.toByteBuffer());
				fc.close();
			} catch (IOException e) {
				e.printStackTrace();
			}
		} catch (FileNotFoundException e) {
			e.printStackTrace();
		}
	}
}
